<template>
    <page-container>
        <view slot="center" class="live-home" v-if="wx_options != null">
            <!-- 顶部、 -->
            <block>
                <view class="live-top" :style="{ top: StatusBar + 'px' }">
                    <DownloadApp></DownloadApp>
                    <view class="live-top-content df-cen-rl">
                        <view class="df-ai-cen anchor-info" style="background:rgba(0,0,0,0.3);">
                            <!-- headimg -->
                            <view class="cu-avatar round" :style="{ backgroundImage: 'url(' + $util.img(wx_options.headimg) + ')' }" v-if="wx_options.headimg!=null && wx_options.headimg!=''"></view>
                            <view class="cu-avatar round" :style="{ backgroundImage: 'url(' + wx_options.image + ')' }" v-else></view>
                            <view class="anchor-user df-col-cen">
                                <view class="anchor-user-name">{{ wx_options.nickname || wx_options.site_name }}</view>
                                <view style="opacity: 0.5;color:#fff;font-size:24rpx">人气{{ views }}</view>
                            </view>
                            <view>
                                <button class="cu-btn round sm bg-orange-red shadow" v-if="!wx_options.follow" @click="subscribeBtn">关注</button>
                                <button class="cu-btn round sm line-red shadow" v-if="wx_options.follow" @click="subscribeBtn">已关注</button>
                            </view>
                        </view>
                        <view></view>
                        <view class="live-top-right df-ai-cen">
                            <view class=" cu-avatar-group ">
                                <block v-for="(item, inx) in memberList" :key="inx">
                                    <view class="cu-avatar round " :style="'background-image: url(' + $util.img(item.avatar) + ')'" v-if="Number(item.userID) != userInfo.member_id"></view>
                                    <view class="cu-avatar round " :style="'background-image: url(' + $util.img(userInfo.headimg) + ')'" v-else>
                                    </view>
                                </block>
                            </view>
                            <view class="close-icon df-cen" style="background: rgba(0, 0, 0, 0.3)!important;"><text class=" cuIcon-close" @click="closeBtn"></text></view>
                        </view>
                        <!-- <view class="live-num mr-10" v-if="liveGroup != null">{{ liveGroup + 1 }}</view> -->
                    </view>
                    <!-- 直播公告 -->
                    <block>
                        <view class="broadcastIcon" @click="broadcastItemHasBtn">
                            <image :src="staticImgUrl + 'live/gonggao.png'" mode=""></image>
                        </view>
                        <view class="zbcBg" v-if="broadcastItemHas==true" @click="broadcastItemHasBtn"></view>
                        <view class="broadcastItem" v-if="broadcastItemHas==true">
                            <view class="broadcastItemTitle">直播公告</view>
                            <view class="broadcastItemInfo">{{wx_options.board || '暂无公告'}}</view>
                            <view class="broadcastItemBtn" @click="broadcastItemHasBtn">确定</view>
                        </view>
                    </block>
                </view>
            </block>
            <block>
                <!-- h5引入直播 -->
                <!-- #ifdef H5 -->
                <view class="video-js" ref="video"></view>
                <!-- #endif -->
                <!-- #ifdef MP-WEIXIN -->
                <!-- @wxLiveError="liveErrorType = true" -->
                <wx-player :optios="wx_options" @wxLiveError="wxLiveError" v-if="liveErrorType == false"></wx-player>
                <!-- #endif -->
                <view class="live-bottom-box df-ai-cen" v-if="broadcastItemHas==false">
                    <view class="live-goods" @click="goodsBtn">
                        <image :src="staticImgUrl + 'live/goods-icon.png'" mode="" />
                        <view class="live-goods-num" v-if="goodsListLive">{{ goodsListLive.length }}</view>
                    </view>
                    <view class="live-bottom-val">
                        <input placeholder="说点什么吧..." v-model="comment" placeholder-style="color:#ffffff" confirm-type="send" @confirm="valConfim" />
                    </view>
                    <view class="live-icon-item" @click="toolBtn">
                        <image :src="staticImgUrl + 'live/live-menu.png'" mode="" />
                    </view>
                    <view class="live-icon-item" @click="giftBtn">
                        <image :src="staticImgUrl + 'live/gifv.png'" mode="" />
                    </view>
                    <view class="live-icon-item">
                        <likeButton :throttle="100" :large="false" :src="staticImgUrl + 'live/love.png'" :width="72" :height="72" :zantype="likeThrottle" @handleClick="likeHandle" @fndbClick="fndbClick">
                        </likeButton>
                    </view>
                </view>
                <!-- 红包，礼物工具 -->
                <view class="live-luckdraw">
                    <block v-if="showhongbao==true">
                        <view class="df-col-cen margin-bottom animation-scale-up" style="animationDelay:0.3s;" @click="packetBtn" v-if="packetObj!=null">
                            <image :src="staticImgUrl + 'live/red-bao.png'" mode="aspectFit" class="luckdraw-icon"></image>
                            <view class="text-white">红包</view>
                        </view>
                    </block>
                    <view class="df-col-cen margin-top animation-scale-up" style="animationDelay:0.3s;" @click="drawsBtnCall" v-if="drawsObj != null">
                        <image :src="staticImgUrl + 'live/live-wallet.png'" mode="aspectFit" class="luckdraw-icon margin-top"></image>
                        <view class="text-white" v-if="drawsTiem != null">{{ drawsTiem.mm }}:{{ drawsTiem.ss }}</view>
                    </view>
                </view>
            </block>

            <!-- h5遮罩层 -->
            <view class="live-mask" v-if="maskType"></view>
            <!-- 聊天框 -->
            <block>
                <view class="im-box">
                    <scroll-view :scroll-top="scrollTop" :scroll-into-view="intoView" id="imscroll" scroll-y="true" style="width: 100%;height: 100%;">
                        <view v-for="(item, inx) in msgList" :key="inx" :id="'imson' + inx">
                            <view class="im-box-row df" v-if="item.type == 1">
                                <view class="im-user-name line-text" :style="{ color: item.color }">{{ item.nick }} :</view>
                                <view class="im-user-text">{{ item.text }}</view>
                            </view>
                            <view class="im-box-row df" v-if="item.type == 2">
                                <view class="im-user-text line-text" :style="{ color: item.color }">
                                    <text class="text-bold" style="font-size: 30rpx;color: red;margin-right: 20rpx;font-style: italic;">通知</text>
                                    {{ item.nick }}加入直播间
                                </view>
                            </view>
                            <view class="im-box-row df" v-if="item.type == 3">
                                <view class="im-user-text line-text" :style="{ color: item.color }">
                                    <text class="text-bold" style="font-size: 30rpx;color: red;margin-right: 20rpx;font-style: italic;">通知</text>
                                    {{ item.nick }}退出直播间
                                </view>
                            </view>
                            <view class="im-box-row df" v-if="item.type == 9">
                                <!-- line-text -->
                                <view class="im-user-text " :style="{ color: item.color }">
                                    <text class="text-bold" style="font-size: 30rpx;color: red;margin-right: 20rpx;font-style: italic;">通知</text>
                                    <text>{{ item.userName }}送给主播{{ item.giftName }}</text>
                                </view>
                            </view>
                        </view>
                    </scroll-view>
                </view>
            </block>
            <!-- 工具栏下拉框 -->
            <bottom-popup :showType="toolType" :headerType="false" bgColor="#252524" @cancel="toolType = false">
                <view slot="content">
                    <view class="tool-title">直播工具</view>
                    <view class="tool-content df-ai-cen">
                        <!-- #ifdef MP-WEIXIN -->
                        <button class="df-col-cen toolbar-share" @click="shareBtn">
                            <view class="tool-content-icon">
                                <image :src="staticImgUrl + 'live/live-share.png'" mode="" />
                            </view>
                            <view class="tool-content-text">分享</view>
                        </button>
                        <!-- #endif -->
                        <!-- #ifdef H5 -->
                        <view class="df-col-cen tool-content-item" @click="shareBtn">
                            <view class="tool-content-icon">
                                <image :src="staticImgUrl + 'live/live-share.png'" mode="" />
                            </view>
                            <view class="tool-content-text">分享</view>
                        </view>
                        <!-- #endif -->
                        <view class="df-col-cen tool-content-item" @click="ceshi">
                            <view class="tool-content-icon">
                                <image :src="staticImgUrl + 'live/live-jubao.png'" mode="" />
                            </view>
                            <view class="tool-content-text">举报</view>
                        </view>
                    </view>
                </view>
            </bottom-popup>
            <!-- 商品的下拉框 -->
            <block v-if="wx_options != null">
                <bottom-popup :showType="goodsType" :headerType="false" bgColor="#222222" @cancel="goodsType = false">
                    <view class="live-goods-box" slot="content">
                        <view class="live-goods-header">全部商品</view>
                        <scroll-view scroll-y="true" class="goods-scrool">
                            <!-- {{ wx_options.goods }} -->
                            <view class="goods-row df margin-bottom" v-for="(item, inx) in goodsListLive" :key="inx" @click="jumpGoods(item)">
                                <view class="goods-row-image pr">
                                    <view class="pa goods-index bg-orange-red df-cen">{{ inx + 1 }}</view>
                                    <image :src="$util.img(item.sku_image)" mode="aspectFill" style="width: 100%;height: 100%;"></image>
                                </view>
                                <view class="goods-row-info df-col">
                                    <view class="goods-row-title">{{ item.sku_name }}</view>
                                    <view class="df-cen-rl">
                                        <view>
                                            <view class="goods-row-marketprice">￥{{ item.market_price }}</view>
                                            <view class="goods-row-price">￥{{ item.price }}</view>
                                        </view>
                                        <button class="cu-btn round bg-orange-red shadow">去购买</button>
                                    </view>
                                </view>
                            </view>
                        </scroll-view>
                    </view>
                </bottom-popup>
            </block>
            <!-- <view class="pf-100 live-error df-cen" v-if="liveErrorType">主播端网络过慢，请刷新试试</view> -->
            <!-- #ifdef H5 -->
            <block v-if="!isNativeApp() && shareContent != null">
                <wx-config :shareContent="shareContent"></wx-config>
            </block>
            <!-- #endif -->

            <!-- 用户没有网络提示 -->

            <block v-if="networkTypeTipsShow">
                <view class="networkTypeTipsTop">
                    <view class="text-networkTypeTipsTop">正在重新连接，请检查网络</view>
                    <view class="zqqaiconImg">
                        <image src="../common/zqqa.png" mode="widthFix"></image>
                    </view>
                </view>
                <view class="networkTypeTips" v-if="showFiveTime==true">当前无网络，请检查网络连接</view>
            </block>

            <!-- 直播已结束提示 -->
            <block v-if="liveErrorType">
                <view class="live-end">
                    <DownloadApp></DownloadApp>
                    <!-- #ifdef H5 -->
                    <view class="df live-error-box" style="width: 100%;justify-content: flex-end;padding: 30rpx 60rpx;">
                        <view @click="closeBtn"><text class="lg text-white cuIcon-close" style="font-size: 50rpx;"></text>
                        </view>
                    </view>
                    <!-- #endif -->
                    <view class="df-cen" style="color: #FFFFFF;opacity: 0.5;font-size: 36rpx;">直播已结束</view>
                    <view class="df-col-cen" style="margin: 200rpx 0;">
                        <view class="cu-avatar round xl" :style="{ backgroundImage: 'url(' + $util.img(wx_options.headimg) + ')' }"></view>
                        <view class="text-white text-bold margin-top">{{ wx_options.nickname }}</view>
                    </view>
                    <view class="df-col-cen">
                        <view class="solid-bottom text-lg margin-bottom text-grey">直播已结束!</view>
                        <button class="cu-btn round margin-top shadow" style="width: 300rpx;background-color: #C7C7C7;" @click="toreplay" v-if="showHuiKan==true">播放回看</button>
                        <button class="cu-btn round bg-orange-red margin-top shadow" style="width: 300rpx;" @click="closeBtn">确定</button>
                    </view>
                </view>
            </block>
            <!-- 点击红包弹窗 -->
            <block>
                <view class="cu-modal " :class="packetType ? 'show' : ''" style="background-color: rgba(0,0,0,.5) !important;" @click="prcketCancal">
                    <view class="cu-dialog" style="background-color: transparent;">
                        <view class="live-luckdraw-call df-cen" @click.stop>
                            <view class="prcket-cancal df-col-cen" @click="prcketCancal"><text class="cuIcon-close "></text>
                            </view>
                            <view class="red-packet-box" style="background-image: url('https://toc.nanyuecloud.com/toc-inst-app/zqanswer/test/img/xmg/live/rea-packet-bg.png');" v-if="!packetInfoShow">
                                <view class=" df-cen" style="margin-top: 80rpx;">
                                    <view class="cu-avatar round sm " :style="{ backgroundImage: 'url(' + $util.img(wx_options.headimg) + ')' }"></view>
                                    <view class="prcket-user">主播{{ wx_options.nickname }}发的红包</view>
                                </view>
                                <!-- 还能领取的时候显示 -->
                                <block v-if="kaiType">
                                    <view class="prcket-kai" @click="prcketKaiBtn">
                                        <image :src="staticImgUrl + 'live/red-kai.png'" mode=""></image>
                                    </view>
                                    <view class="prcket-tip">{{ packetObj.pintro }}</view>
                                </block>
                                <!-- 领取完的时候显示 -->
                                <block v-else>
                                    <view class="prcket-tip" v-if="lingguoType">你已经领取过了</view>
                                    <view class="prcket-tip" v-else>手慢了，红包派完了</view>
                                </block>
                                <view class="prcket-info" @click="checkPrcketInfo">
                                    查看详情
                                    <text class="cuIcon-right"></text>
                                </view>
                            </view>
                            <block v-if="packetInfoList != null">
                                <view class="red-packet-box red-packet-list df-col" v-if="packetInfoShow">
                                    <view class="red-packet-list-header df-ai-cen bg-orange-red">
                                        <view @click="packetInfoShow = false"><text class="lg text-white cuIcon-back" style="font-size: 36rpx;"></text></view>
                                        <view class="packet-header-title">详情</view>
                                    </view>
                                    <view class="red-packet-price df-col-cen" v-if="packetInfoList.my_amount > 0">
                                        <view class="price-check">
                                            <text style="font-size: 58rpx;color: #FD3E5B;">{{ packetInfoList.my_amount }}</text>
                                            元
                                        </view>
                                        <view class="wallet-text">已存入钱包</view>
                                    </view>
                                    <view class="packet-number">
                                        已领取
                                        {{ packetInfoList.getList.length }}/{{ packetInfoList.count }}个，共{{ packetInfoList.left }}/{{ packetInfoList.total }}元
                                    </view>
                                    <view class="packet-scrool">
                                        <scroll-view scroll-y="true" style="width: 100%;height: 100%;">
                                            <view class="df-cen-rl packet-scrool-row" v-for="(item, inx) in packetInfoList.getList" :key="inx">
                                                <view class="df-ai-cen">
                                                    <view class="cu-avatar round margin-right" :style="{ backgroundImage: 'url(' + $util.img(item.headimg) + ')' }">
                                                    </view>
                                                    <view class="df-col" style="align-items: baseline;">
                                                        <view>{{ item.nickname }}</view>
                                                        <view class="packet-row-time">{{ item.get_date }}</view>
                                                    </view>
                                                </view>
                                                <view>{{ item.amount }}元</view>
                                            </view>
                                        </scroll-view>
                                    </view>
                                </view>
                            </block>
                        </view>
                    </view>
                </view>
            </block>
            <block>
                <view class="cu-modal " :class="drawsType ? 'show' : ''" style="background-color: rgba(0,0,0,.5) !important;" @click="drwasCancal">
                    <view class="cu-dialog" style="background-color: transparent;">
                        <view class="live-darws-call df-cen" @click.stop>
                            <view class="prcket-cancal df-col-cen" @click="drwasCancal"><text class="cuIcon-close "></text>
                            </view>
                            <view class="drwas-box" v-if="!drawPrizeShow" style="background-image: url('https://toc.nanyuecloud.com/toc-inst-app/zqanswer/test/img/xmg/live/draws-bg.png');">
                                <view class="drwas-box-btn df-cen" @click="drwasBtn">立即抽奖</view>
                            </view>
                            <view v-else class="draws-prize df-col" style="background-image: url('https://toc.nanyuecloud.com/toc-inst-app/zqanswer/test/img/xmg/live/draw-box-bg.png?456465465');">
                                <view class="prize-check-title df-cen">
                                    <text class="prize-tltie">{{ prizeConfim ? '中奖啦！' : '未中奖！' }}</text>
                                </view>
                                <!-- 中奖显示 -->
                                <block v-if="prizeConfim">
                                    <view class="prize-content">
                                        <view class="content-title">恭喜您获得</view>
                                        <view class="prize-content-info">
                                            <!-- 小米10手机1台(实物) -->
                                            <!-- adidas男士经典淡香香水50元优惠券 (虚拟) -->
                                            {{ prizeText }}
                                        </view>
                                        <block>
                                            <view class="prize-btn-box">
                                                <!-- <button class="cu-btn round bg-orange-red shadow" style="width: 320rpx;">填写地址-实物</button> -->
                                                <!--  -->
                                                <button class="cu-btn round bg-orange-red shadow" style="width: 320rpx;" @click="confimDianJiFn">确定</button>
                                            </view>
                                            <view class="prize-tip">中奖信息将在7个工作日内发送给您</view>
                                        </block>
                                    </view>
                                </block>
                                <block v-else>
                                    <view class="prize-content">
                                        <view class="prize-content-info">
                                            <view>很遗憾！</view>
                                            <view>下次再来试试吧！</view>
                                        </view>
                                        <block>
                                            <view class="prize-btn-box">
                                                <button class="cu-btn round bg-orange-red shadow" style="width: 320rpx;" @click="confimDianJiFn">确定</button>
                                            </view>
                                        </block>
                                    </view>
                                </block>
                            </view>
                        </view>
                    </view>
                </view>
            </block>
            <!-- svga -->
            <!-- #ifdef H5 -->
            <block v-if="showSvgaBox==true">
                <div class="svgaPage">
                    <div id="svgaBox"></div>
                </div>
            </block>
            <!-- #endif -->
            <!-- #ifdef MP-WEIXIN -->
            <block v-if="showSvgaBox==true">
                <canvas type="2d" id="svgaBox"></canvas>
            </block>
            <!-- #endif -->

            <block v-if="liveGiftList.length > 0">
                <live-gift :giftShow="giftType" :giftList="liveGiftList" @giftCancelCall="giftCancel" @giftCall="giftCallFn"></live-gift>
            </block>
            <block v-if="showFenXiang==true">
                <fenxiang @closeFx="closeFx"></fenxiang>
            </block>

            <liveActivity></liveActivity>

        </view>
    </page-container>
</template>

<script>
import liveActivity from '@/livePages/components/liveActivity.vue'
// #ifdef MP-WEIXIN
import SVGA from '../common/js/svga.min.js'
// #endif
// #ifdef H5
import SVGA from 'svgaplayerweb';
// #endif
// #ifdef H5
import TIM from '../common/js/tim-js.js'; //Web 环境
// #endif
// #ifdef MP-WEIXIN
import TIM from '../common/js/tim-wx.js'; //小程序 环境
// #endif
import likeButton from '@/livePages/components/like-button.vue';
// #ifdef H5
import txPlayer from '@/livePages/components/h5-player.vue';
import wxConfig from '@/common/components/global/wx-config.vue';
// #endif
// #ifdef MP-WEIXIN
import wxPlayer from '@/livePages/components/wx-player.vue';
// #endif
import liveGift from '@/livePages/components/live-gift';
import DownloadApp from '@/common/components/global/download-app.vue'
import tencentTim from '@/livePages/common/js/im.js';
import fenxiang from '@/livePages/components/fenxiang.vue'
import {
    mapGetters
} from 'vuex';
export default {
    name: 'live',
    components: {
        liveActivity,
        fenxiang,
        liveGift,
        DownloadApp,
        likeButton,
        // #ifdef H5
        txPlayer: txPlayer,
        wxConfig,
        // #endif
        // #ifdef MP-WEIXIN
        wxPlayer: wxPlayer
        // #endif
    },
    data() {
        return {
            showFenXiang: false,
            showHuiKan: false,
            showSvgaBox: false,
            // #ifdef MP-WEIXIN
            StatusBar: this.StatusBar + 12,
            // #endif
            // #ifdef H5
            StatusBar: this.StatusBar,
            // #endif
            wx_options: null,
            maskType: false,
            toolType: false,
            goodsType: false,
            liveErrorType: false,
            shareContent: null,
            comment: '',
            timContent: null,
            timMessageBox: false, // 判断腾讯im是否初始化了
            msgList: [],
            scrollTop: 0,
            intoView: '',
            imUserColor: ['#FDDD8B', '#66F4FF', '#ff2e2c', '#ffd332', '#0b76f5', '#ffffff'],
            liveGiftList: [],
            giftType: false,
            gfitThrottle: false,
            likeThrottle: false, // 点赞交互节流
            packetType: false, // 红包弹框弹出
            packetInfoShow: false, // 红包详情隐藏显示
            packetInfoList: null, // 红包详情列表
            packetObj: null, // 红包数据
            kaiType: false, // 是否开了该红包
            lingguoType: false, // 判断是否领过红包
            drawsTiem: null, // 抽奖倒计时
            drawsContent: null, // 抽奖定时器
            drawsType: false, // 抽奖弹框
            drawPrizeShow: false, // 是否开奖了
            prizeConfim: false, // 是否中奖
            drawsObj: null, // 抽奖需要的参数
            prizeText: '', // 中奖文本提示
            liveGroup: null, // 直播人数
            memberList: [], // 右上角显示的人数
            videoCeshi: null,
            broadcastItemHas: false,
            showhongbao: false,
            views: 0,
            networkTypeTipsShow: false,
            showFiveTime: true,
            index: 0,
            start_time: 0,
            end_time: 0,
            // 控制不能连续点击
            notBtn: false,
            shownum: 0,
            timer: null,
            goodsTimer: null,
            goodsListLive: []
        };
    },
    computed: {
        ...mapGetters(['userInfo', 'token'])
    },
    onHide() {
        this.showFenXiang = false
    },
    onLoad() {
        this.$request.getLiveGifts().then(res => {
            this.liveGiftList = res.data;
            console.log('礼物列表', this.liveGiftList);
        });
    },
    onUnload() {
        // let dataObj = {
        // 	headimg: this.userInfo.headimg,
        // 	nick: this.userInfo.nickname,
        // 	text: '退出直播间',
        // 	type: 3
        // };
        // this.timContent.sendMessage(this.wx_options.id.toString(), JSON.stringify(dataObj));
        this.timContent.logout()
        // clearInterval(this.goodsTimer)
    },
    onShow() {
        let optiops = this.$util.queryObj();
        console.log(optiops)
        // this.getGoodsTimer()
        if (this.videoCeshi != null) {
            this.videoCeshi.play();
        }
        // 判断用户是否登录

        if (this.timMessageBox) return false;
        /**
         * user_id 用于 用户未登录情况也能接受 im 消息
         */
        let user_id = Math.random().toString()
        this.$request.getImUserSig({ user_id: user_id }).then(sig => {
            console.log("==============...............========")
            console.log(sig)
            console.log("======================")
            var itmeotBox = null;
            this.timContent = new tencentTim(msg => {
                console.log("======================")
                console.log('this.timContent', msg);
                console.log("======================")


                if (msg.name == "receiveGroupSystemNotice") {
                    if (msg.data.type == 5) {
                        this.liveErrorType = true
                    }
                }

                let networkTypeMsg = msg.data.state
                if (networkTypeMsg == "connecting") {
                    this.networkTypeTipsShow = true;
                    setTimeout(() => {
                        this.showFiveTime = false
                    }, 5000)
                } else {
                    this.networkTypeTipsShow = false;
                }
                if (itmeotBox != null) {
                    clearTimeout(itmeotBox);
                }
                // (小程序，h5)端的type跟app端的cmd对应字段解释请看@/livePages/common/IM_TYPE.md
                // 处理文本消息
                if (msg.data[0].type == 'TIMTextElem') {
                    let newMsg = JSON.parse(msg.data[0].payload.text);
                    console.log("H5/小程序newMsg=>", newMsg)
                    if (this.$util.regCheckAll.isPhone(newMsg.nick)) {
                        let reg = /^(\d{3})\d*(\d{3})$/;
                        newMsg['nick'] = newMsg.nick.replace(reg, '$1****$2');
                    }
                    if (newMsg.type == 1 || newMsg.type == 3 || newMsg.type == 9) {
                        let imMsgObj = {
                            ...newMsg,
                            color: this.imUserColor[Math.floor(Math.random() * 6)]
                        };
                        this.msgList.push(imMsgObj);
                    }
                    if (newMsg.type == 4) {
                        this.zanCall();
                    }
                    // 刷新商品
                    if (newMsg.type == 12) {
                        this.getGoodsTimer()
                    }
                }

                // 处理app端的消息
                if (msg.data[0].type == 'TIMCustomElem') {
                    // console.log("App端msg.data[0]=>", msg.data[0])
                    if (msg.data[0]._elements.length > 1) {
                        let newNick = msg.data[0].nick;
                        if (this.$util.regCheckAll.isPhone(newNick)) {
                            let reg = /^(\d{3})\d*(\d{3})$/;
                            newNick = msg.data[0].nick.replace(reg, '$1****$2');
                        }
                        this.msgList.push({
                            nick: newNick,
                            text: msg.data[0]._elements[1].content.text,
                            type: 1,
                            color: this.imUserColor[Math.floor(Math.random() * 6)]
                        });
                    }
                    if (msg.data[0]._elements.length == 1) {
                        let hongbaoObj = JSON.parse(msg.data[0]._elements[0].content.data);
                        // 主播发红包了
                        if (hongbaoObj.data.cmd == '7') {
                            let newArr = hongbaoObj.data.msg.split(',');
                            console.log("newArr=>", newArr)

                            // this.wx_options.redpackets=

                            var packetObj = {
                                pid: newArr[0],
                                pintro: newArr[1],
                                pfans: newArr[3]
                            };
                            this.packetObj = packetObj
                            this.wx_options.redpackets[0] = packetObj
                            this.showhongbao = true
                            console.log("this.packetObj=>", this.packetObj)
                        }
                        if (hongbaoObj.data.cmd == '4') {
                            this.zanCall();
                        }
                        //  || hongbaoObj.data.cmd == '3' (退出直播间)
                        if (hongbaoObj.data.cmd == '2') {
                            // console.log("~有人进来~")
                            let newNick = hongbaoObj.data.userName;
                            if (this.$util.regCheckAll.isPhone(newNick)) {
                                let reg = /^(\d{3})\d*(\d{3})$/;
                                newNick = newNick.replace(reg, '$1****$2');
                            }
                            let imMsgObj = {
                                nick: newNick,
                                type: Number(hongbaoObj.data.cmd),
                                color: this.imUserColor[Math.floor(Math.random() * 6)]
                            };
                            this.msgList.push(imMsgObj);

                        }
                        if (hongbaoObj.data.cmd == '8') {
                            this.drawsObj = null;
                            let newArr = hongbaoObj.data.msg.split(',');
                            let newObj = {
                                did: Number(newArr[0]),
                                createtime: Math.floor(new Date().getTime() / 1000),
                                countDown: Number(newArr[1]),
                                isFans: Number(newArr[3])
                            };
                            this.drawsObj = newObj;
                            this.drawsTiemDown((Number(this.drawsObj.createtime) + this.drawsObj
                                .countDown) * 1000);
                        }
                        if (hongbaoObj.data.cmd == '9') {
                            let giftObj = JSON.parse(hongbaoObj.data.msg);
                            if (this.$util.regCheckAll.isPhone(giftObj.userName)) {
                                let reg = /^(\d{3})\d*(\d{3})$/;
                                giftObj.userName = giftObj.userName.replace(reg, '$1****$2');
                            }
                            this.msgList.push({
                                ...giftObj,
                                type: 9,
                                color: this.imUserColor[Math.floor(Math.random() * 6)]
                            });
                        }
                        if (hongbaoObj.data.cmd == '10') {
                            this.liveErrorType = true
                        }
                    }
                }
                // 处理加入群聊通知
                if (msg.data[0].type == 'TIMGroupTipElem') {
                    if (msg.data[0].nick != '') {
                        // console.log("~有人进来处理加入群聊通知~")
                        let newNick = msg.data[0].nick;
                        if (this.$util.regCheckAll.isPhone(newNick)) {
                            let reg = /^(\d{3})\d*(\d{3})$/;
                            newNick = newNick.replace(reg, '$1****$2');
                        }
                        this.msgList.push({
                            nick: newNick,
                            type: 2,
                            color: this.imUserColor[Math.floor(Math.random() * 6)]
                        });
                        // 当直播间有用户加入群聊时候更新人气值
                        this.$request.getLiveDetail({
                            id: optiops.live_id
                        }).then(res => {
                            // console.log("直播间实时更新人气值",res.views)
                            this.views = res.data.views
                        })
                    }
                }



                let inx = this.msgList.length - 1;
                itmeotBox = setTimeout(() => {
                    this.intoView = 'imson' + inx;
                    clearTimeout(itmeotBox);
                    itmeotBox = null;
                }, 100);
            })
            console.log(this.userInfo, 'userInfo')
            console.log(this.token ? this.userInfo.member_id : user_id)
            this.userInfo.member_id = this.userInfo.member_id.toString()
            this.timContent.login(this.token ? this.userInfo.member_id : user_id, sig).then(res => {
                console.log("======================")
                console.log('timContentLogin', res);
                console.log("======================")
                // 初始化
                this.timContent.imReady()
                // 初始化失败
                this.timContent.getNotReady()
                // 网络状态发生变化
                this.timContent.getNetWork()
                // 直播结束
                this.timContent.groupReceived()

                // 加入直播间聊天
                this.timContent.joinGroup(optiops.live_id).then(res => {
                    console.log("======================")
                    console.log('joinGroup', res);
                    console.log("======================")
                    if (res.code === 0) {
                        let dataObj = {
                            headimg: this.userInfo.headimg,
                            nick: this.userInfo.nickname,
                            text: '加入直播间',
                            type: 2
                        };
                        this.timContent.sendMessage(this.wx_options.id.toString(), JSON
                            .stringify(dataObj));
                        this.timContent.getGroupMemberList(optiops.live_id, 3, 0).then(
                            success => {
                                //                         console.log("======================")
                                //                         console.log('getGroupMemberList', success.data
                                //                         	.memberList);
                                //                         console.log("======================")
                                //                         this.memberList = success.data.memberList;
                                // console.log("this.memberList",this.memberList)
                            });
                        this.getGroupNumber(optiops.live_id);
                        setInterval(() => {
                            this.getGroupNumber(optiops.live_id);
                        }, 30000);
                        // 当直播间有用户加入群聊时候更新人气值
                        this.$request.getLiveDetail({
                            id: optiops.live_id
                        }).then(res => {
                            // console.log("直播间实时更新人气值",res.views)
                            this.views = res.data.views
                        })
                    }
                }).catch(err => {
                    console.log("err", err.code)
                    if (err.code == 10010) {
                        this.liveErrorType = true
                    }
                })
                // 调用推流信息
                this.timContent.getImCustomMessageReceived()
                this.timMessageBox = true;
            });
        })

        this.$request.getLiveDetail({
            id: optiops.live_id
        }).then(res => {
            console.log("======================")
            console.log('getLiveDetail', res);
            console.log("======================")
            if (res.data.pushing == 0) {
                if (res.data.replay_url == null) {
                    // console.log("没有回看")
                    this.showHuiKan = false
                    this.liveErrorType = true
                } else {
                    // console.log("有回看")
                    this.$Router.reLaunch({
                        path: '/livePages/live/replay',
                        query: {
                            live_id: res.data.id
                        }
                    });
                    setTimeout(() => {
                        this.showHuiKan = true
                        this.liveErrorType = true
                    }, 500)
                }
            }
            this.wx_options = res.data;
            this.views = res.data.views
            this.goodsListLive = res.data.goods
            console.log("======================")
            console.log('this.wx_options', this.wx_options);
            console.log("======================")
            // 判断主播之前是否发送了红包
            if (res.data.redpackets.length > 0) {
                // console.warn('判断主播之前是否发送了红包', res.redpackets);
                this.packetObj = res.redpackets[0];
                this.showhongbao = true
            }
            // 判断主播之前是否发送了抽奖
            if (res.data.draws.length > 0) {
                // console.warn('判断主播之前是否发送了抽奖', res.draws);
                this.drawsObj = res.draws[0];
                this.drawsTiemDown((Number(this.drawsObj.createtime) + this.drawsObj.countDown) * 1000);
            }
            this.shareContent = {
                title: res.title, // 分享标题
                shareObjectDesc: '醒目购，够醒目，醒目就购啦！', // 分享描述
                thumbUrl: res.image // 分享图标
            };
            // #ifdef H5
            let sUserAgent = navigator.userAgent.toLowerCase();
            var isHuawei = sUserAgent.match(/huawei/i) == 'huawei';
            var isHonor = sUserAgent.match(/honor/i) == 'honor';
            // 华为机型跳外链用腾讯播放器处理
            if (isHuawei || isHonor) {
                let url =
                    'https://toc.nanyuecloud.com/toc-inst-app/zqanswer/test/index.html#/xmg/live?live_id=' +
                    this.wx_options.id;
                location.href = url;
                return false;
            }
            // 使用video.js处理h5播放器
            setTimeout(() => {
                var video = document.createElement('video');
                video.id = 'video';
                video.style = 'width: 100%;height: 100%;object-fit: cover'; // object-fit: cover 全屏;
                video.setAttribute('playsinline', true); //IOS微信浏览器支持小窗内播放
                video.setAttribute('webkit-playsinline',
                    true); //这个bai属性是ios 10中设置可以让视频在小du窗内播放，也就是不是全zhi屏播放的video标签的一个属性
                video.setAttribute('x5-video-player-type', 'h5'); //安卓 声明启用同层H5播放器 可以在video上面加东西
                video.controls = true;
                var source = document.createElement('source');
                source.src = this.wx_options.m3u8url;
                source.type = 'application/x-mpegURL';
                video.appendChild(source);
                // console.log("this.wx_options.m3u8url=>",this.wx_options.m3u8url)
                // console.log("video",video)
                this.$refs.video.$el.appendChild(video);
                let _that = this;
                this.videoCeshi = videojs(
                    'video', {
                    poster: _that.wx_options.image, // 视频封面图地址
                    title: '12334567788999900',
                    // playbackRates: [0.7, 1.0, 1.5, 2.0], //播放速度
                    autoDisable: true,
                    preload: 'none', //auto - 当页面加载后载入整个视频 meta - 当页面加载后只载入元数据 none - 当页面加载后不载入视频
                    language: 'zh-CN',
                    fluid: true, // 自适应宽高
                    muted: false, //  是否静音
                    aspectRatio: '16:9', // 将播放器置于流畅模式，并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字（例如"16:9"或"4:3"）
                    controls: true, //是否拥有控制条 【默认true】,如果设为false ,那么只能通过api进行控制了。也就是说界面上不会出现任何控制按钮
                    autoplay: false, //如果true,浏览器准备好时开始回放。 autoplay: "muted", // //自动播放属性,muted:静音播放
                    loop: false, // 导致视频一结束就重新开始。 视频播放结束后，是否循环播放
                    techOrder: ['html5'], //播放顺序
                    screenshot: true,
                    controlBar: {
                        volumePanel: {
                            //声音样式
                            inline: false // 不使用水平方式
                        },
                        timeDivider: false, // 时间分割线
                        durationDisplay: false, // 总时间
                        progressControl: false, // 进度条
                        remainingTimeDisplay: false, //当前以播放时间
                        fullscreenToggle: false, //全屏按钮
                        pictureInPictureToggle: false //画中画
                    }
                },
                    function () {
                        this.on('error', e => {
                            //拉流错误
                            let errorCode = e.target.player.error_.code
                            console.log('拉流错误', errorCode);
                            if (errorCode == 4) {
                                _that.liveErrorType = true;
                            }
                        });
                        this.on('stalled', function () {
                            //网速失速
                            console.log('网速失速');
                        });
                        this.on('play', function () {
                            //开始播放
                            _that.maskType = true;
                        });
                        this.on('pause', function () {
                            //暂停
                            console.log('暂停');
                        });
                        this.on('timeupdate', function () {
                            // console.log('timeupdate');
                        });
                    }
                );
            }, 200);
            // #endif
        });
    },
    methods: {
        getGoodsTimer() {
            console.log('进来了进来了进来了')
            let optiops = this.$util.queryObj();
            // this.goodsTimer = setInterval(() => {
            this.$request.getLiveDetail({
                id: optiops.live_id
            }).then(res => {
                console.log("res=>", res)
                this.goodsListLive = res.goods
            })
            // }, 60000)
        },
        toreplay() {
            console.log("this.wx_options", this.wx_options)
            if (this.wx_options.replay_url == null) {
                console.log("没有回看地址")
            } else {
                this.$Router.push({
                    path: '/livePages/live/replay',
                    query: {
                        live_id: this.wx_options.id
                    }
                });
            }
        },
        // 处理小程序直播结束
        wxLiveError(e) {
            // console.log("wxLiveError=>",e)
            // this.reloadIm()
            // var num = 0
            // let timer = setInterval(()=>{
            // 	if (e.type == "error") {
            // 		num++
            // 	}
            // 	if(num>=10){
            // 		this.liveErrorType = true
            // 		clearInterval(timer)
            // 	}else{
            // 		this.reloadIm()
            // 	}
            // 	console.log("num=>",num)
            // },1000)
            // this.timer = timer

            // let timer = setInterval(()=>{
            // 	// num++
            // 	// if(num>=3){
            // 	// 	this.liveErrorType = true
            // 	// 	clearInterval(timer)
            // 	// }else{
            // 		// this.reloadIm()
            // 	// }
            // },1000)
        },
        //点击播放svga
        playSvga() {
            let num = 0
            num++
            this.shownum = this.shownum + num
            // var notBtn = this.notBtn
            // if (notBtn == true) {
            // }else{
            // 	this.notBtn = true
            this.showSvgaBox = true
            setTimeout(() => {
                let player = new SVGA.Player('#svgaBox');
                let parser = new SVGA.Parser();
                //注意，这里必须是服务器地址，否则报错
                // https://cdn.jsdelivr.net/gh/svga/SVGA-Samples@master/angel.svga
                parser.load('https://cdn.jsdelivr.net/gh/svga/SVGA-Samples@master/angel.svga', videoItem => {
                    console.log("播放次数", this.shownum)
                    player.loops = this.shownum; // 设置循环播放次数是1
                    player.setVideoItem(videoItem);
                    player.startAnimation();
                    player.onFinished(() => {
                        // this.notBtn = false
                        this.shownum = 0
                    })
                });
            }, 200)
            // }
        },
        getGroupNumber(id) {
            this.timContent.getGroupOnlineMemberCount(id).then(success => {
                this.liveGroup = success.data.memberCount;
            });
        },
        closeBtn() {
            this.$util.compatiBleJump({
                key: 'exit'
            }, 1);
        },
        // 处理其他用户点赞监听
        zanCall() {
            if (this.likeThrottle) return false;
            this.likeThrottle = true;
            setTimeout(() => {
                this.likeThrottle = false;
            }, 120);
        },
        likeHandle(e) {
            if (!this.$util.isLoginCall()) return false;
            if (this.likeThrottle) return false;
            let dataObj = {
                headimg: this.userInfo.headimg,
                nick: this.userInfo.nickname,
                text: '点赞啦啦',
                type: 4
            };
            this.timContent.sendMessage(this.wx_options.id.toString(), JSON.stringify(dataObj));
        },
        closeFx(e) {
            this.showFenXiang = e
        },
        shareBtn(e) {
            this.toolType = false
            // #ifdef H5
            if (this.isNativeApp()) {
                var urlnews = location.href.indexOf("?") == -1 ? "?" : "&"
                this.$Sdk.share(this.shareContent.title, location.href + urlnews + 'source_member=' + this
                    .userInfo.member_id, this.shareContent.thumbUrl)
            } else {
                this.showFenXiang = !this.showFenXiang
                console.log('H5分享', this.showFenXiang);
            }
            // #endif
            // #ifdef MP-WEIXIN
            this.showFenXiang = !this.showFenXiang
            console.log('小程序分享', this.showFenXiang);
            // #endif
        },
        ceshi(e) {
            this.$util.tip('暂未开发，请前往醒目购app体验，(#^.^#)');
        },
        // 礼物icon点击
        giftBtn() {
            if (!this.$util.isLoginCall()) return false;
            this.giftType = true;
        },
        giftCancel() {
            this.giftType = false;
        },
        // 礼物赠送回调
        giftCallFn(val) {
            if (this.timContent != null && !this.gfitThrottle) {
                this.gfitThrottle = true;
                this.$request
                    .sendGift({
                        id: this.wx_options.id,
                        gid: val.gid
                    })
                    .then(res => {
                        let giftObj = {
                            giftName: val.gname,
                            giftId: val.gid,
                            userName: this.userInfo.nickname,
                            userAvatar: this.userInfo.headimg,
                            giftImg: val.gimg,
                            type: 9
                        };
                        this.timContent.sendMessage(this.wx_options.id.toString(), JSON.stringify(giftObj));
                        this.msgList.push({
                            ...giftObj,
                            color: this.imUserColor[Math.floor(Math.random() * 6)]
                        });
                        this.gfitThrottle = false;
                        this.$util.tip('赠送成功')
                    })
                    .catch(err => {
                        this.$util.tip(err.data);
                        this.gfitThrottle = false;
                    });
            }
        },
        // 工具栏点击
        toolBtn() {
            this.toolType = true;
        },
        // 商品点击
        goodsBtn() {
            this.goodsType = true;
        },
        // 商品跳转
        jumpGoods(val) {
            this.$util.redirectTo('/pages/goods/detail/detail', {
                sku_id: val.sku_id
            })
            // this.$Router.push({
            //     path: '/shopPages/goods/detail',
            //     query: {
            //         goods_id: val.sku_id,
            //         is_id: val.sku_id,
            //         live_id: this.wx_options.id,
            //         type: 1
            //     }
            // });
        },
        // 判断是否关注用户
        subscribeBtn() {
            if (!this.$util.isLoginCall()) return false;
            if (this.wx_options.follow) {
                uni.showModal({
                    title: '温馨提示',
                    content: '确定真的不关注主播了吗？ ┭┮﹏┭┮',
                    success: res => {
                        if (res.confirm) {
                            this.$request
                                .deleteMemberFollow({
                                    followers_id: this.wx_options.member_id
                                })
                                .then(res => {
                                    this.wx_options.follow = false;
                                    this.$util.tip('香菇蓝瘦，┭┮﹏┭┮');
                                });
                        }
                    }
                });
            } else {
                this.$request
                    .addMemberFollow({
                        followers_id: this.wx_options.member_id
                    })
                    .then(res => {
                        this.wx_options.follow = true;
                        this.$util.tip('好嗨森~~~(#^.^#)');
                    });
            }
        },
        valConfim(e) {
            if (!this.$util.isLoginCall()) return false;
            console.log('可以')
            if (!this.timMessageBox) return false;
            console.log(this.timMessageBox)
            console.log('来了')
            let val = e.detail.value || e.target.value || '';
            if (val == '') {
                this.$util.tip('~说点什么吧~')
                return
            }
            let dataObj = {
                headimg: this.userInfo.headimg,
                nick: this.userInfo.nickname,
                text: val,
                type: 1
            };
            console.log("======================")
            console.log('valConfim', dataObj);
            console.log("======================")
            this.timContent.sendMessage(this.wx_options.id.toString(), JSON.stringify(dataObj));
            this.msgList.push({
                nick: '我',
                text: val,
                type: 1,
                color: this.imUserColor[Math.floor(Math.random() * 6)]
            });
            console.log("======================")
            console.log('msgList', this.msgList);
            console.log("======================")
            setTimeout(() => {
                let inx = this.msgList.length - 1;
                this.intoView = 'imson' + inx;
                this.comment = '';
            }, 100);
        },
        drawsTiemDown(tiem) {
            if (this.$util.countdown(tiem)) {
                this.drawsContent = setInterval(() => {
                    if (this.$util.countdown(tiem)) {
                        this.drawsTiem = this.$util.countdown(tiem);
                    } else {
                        this.drawsTiem = null;
                        clearInterval(this.drawsContent);
                    }
                    // console.log('1614583461', this.$util.countdown(tiem));
                }, 1000);
            }
        },
        drwasCancal() {
            this.drawsType = false;
        },
        drwasBtn() {
            this.$request
                .getDoDraws({
                    did: this.drawsObj.did
                })
                .then(res => {
                    console.log('点击了立即抽奖', res);
                    this.drawsObj = null;
                    this.prizeText = res;
                    this.prizeConfim = !!res;
                    this.drawPrizeShow = true;
                })
                .catch(err => {
                    this.drawsObj = null;
                    this.drawsType = false;
                    this.$util.tip(err.data);
                });
        },
        confimDianJiFn() {
            this.drawsObj = null;
            this.drawsType = false;
            let newTime = setTimeout(() => {
                this.prizeText = '';
                this.drawPrizeShow = true;
                this.prizeConfim = false;
                clearTimeout(newTime);
            }, 200);
        },
        drawsBtnCall() {
            if (!this.$util.isLoginCall()) return false;
            // 关注才能领取的
            console.log('关注才能领取的', this.drawsObj.isFans, this.wx_options.follow);
            if (this.drawsObj.isFans === 0 && !this.wx_options.follow) {
                this.$util.tip('只有粉丝才能领取该红包');
                return false;
            }
            let tiem = (Number(this.drawsObj.createtime) + this.drawsObj.countDown) * 1000;
            if (!this.$util.countdown(tiem)) {
                this.drawsType = true;
                this.drawPrizeShow = false;
            }
        },
        prcketCancal() {
            this.packetType = false;
            setTimeout(() => {
                this.packetInfoShow = false;
            }, 300);
        },
        // 打开红包
        packetBtn() {
            // // #ifdef H5
            // this.$util.tip('点击右上角打开前往app抢红包喔亲');
            // return false
            // // #endif
            // // #ifdef MP-WEIXIN
            // this.$util.tip('请打开前往醒目购app抢红包喔亲');
            // // #endif
            // return false;
            // console.log("打开红包")
            if (!this.$util.isLoginCall()) return false;
            console.log("this.wx_options", this.wx_options)
            if (this.wx_options.redpackets[0].pfans != 0) {

                if (!this.wx_options.follow) {
                    console.log('关注才能领取的')
                    this.$util.tip("关注主播才能抢红包哟")
                    return false
                } else {
                    console.log('关注了')
                    this.$request.setSedPacketDetail({
                        pid: this.packetObj.pid
                    }).then(res => {
                        console.log("res", res)
                        if (res.my_amount > 0) {
                            this.lingguoType = true;
                        } else {
                            if (res.count > res.getList.length) {
                                this.kaiType = true;
                            } else {
                                this.kaiType = false;
                            }
                        }
                        this.packetType = true;
                    });
                }
            } else if (this.wx_options.redpackets[0].pshare != 0) {
                console.log('要分享')
                this.$util.tip("分享直播间才能抢红包哟")
                return false
            } else {
                console.log("this.wx_options.redpackets[0].pfans", this.wx_options.redpackets[0].pfans)
                console.log("不用关注，不用分享")
                this.$request.setSedPacketDetail({
                    pid: this.packetObj.pid
                }).then(res => {
                    console.log("res", res)
                    if (res.my_amount > 0) {
                        this.lingguoType = true;
                    } else {
                        if (res.count > res.getList.length) {
                            this.kaiType = true;
                        } else {
                            this.kaiType = false;
                        }
                    }
                    this.packetType = true;
                });
            }
        },
        prcketKaiBtn() {
            this.$request
                .getRedPacket({
                    pid: this.packetObj.pid
                })
                .then(res => {
                    this.$request.setSedPacketDetail({
                        pid: this.packetObj.pid
                    }).then(res => {
                        this.packetInfoList = res;
                        this.packetInfoShow = true;
                        this.showhongbao = false
                    });
                })
                .catch(e => {
                    if (e.code == -1 && e.data == '红包已被领完') {
                        console.log("红包已被领完===>", e)
                        this.kaiType = false;
                        this.packetType = true;
                        this.showhongbao = false
                    }
                    if (e.code == -1 && e.data == '您已领取') {
                        console.log("您已领取===>", e)
                        this.kaiType = false;
                        this.lingguoType = true;
                        this.packetType = true;
                        this.showhongbao = false
                    }

                });

        },
        // 查看红包
        checkPrcketInfo() {
            this.$request.setSedPacketDetail({
                pid: this.packetObj.pid
            }).then(res => {
                this.packetInfoList = res;
                this.packetInfoShow = true;
                console.warn('查红包', this.packetInfoList);
            });
        },
        // 打开公告
        broadcastItemHasBtn() {
            this.broadcastItemHas = !this.broadcastItemHas
            this.$request.getLiveDetail({
                id: this.$util.queryObj().live_id
            }).then(res => {
                this.wx_options.board = res.board;
            })
        },
        // 双击
        fndbClick() {
            this.index = this.index == 0 ? 1 : this.index + 1;
            if (this.index == 1) {
                this.start_time = new Date().getTime();
                setTimeout(() => {
                    this.index = this.start_time = this.end_time = 0;
                }, 200)
            } else if (this.index == 2) {
                this.end_time = new Date().getTime();
                if (this.end_time - this.start_time < 300) {
                    uni.showToast({
                        title: '双击了屏幕',
                        icon: 'none'
                    })
                }
                this.index = this.start_time = this.end_time = 0;
            }
        },
    },
    onShareAppMessage(res) {
        if (res.from === 'button') {
            // 来自页面内分享按钮
            console.log(res.target);
        }
        var url = '/livePages/live/live?live_id=' + this.wx_options.id;
        return {
            title: this.wx_options.title,
            path: url,
            imageUrl: this.wx_options.image
        };
    },
    onShareTimeline(res) {
        var url = '/livePages/live/live?live_id=' + this.wx_options.id;
        return {
            title: this.wx_options.title,
            path: url,
            imageUrl: this.wx_options.image
        };
    },
};
</script>

<style lang="scss">
@import "../common/css/live.scss";

#svgaBox {
    width: 100%;
    height: 800rpx;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
</style>
